/**
 * English Wet Capacity Unit Tests
 * Tests convert and toUnit for each Unit Type
 */

package cmsc495.mach2.test.unit.english;

import cmsc495.mach2.unit.english.EnglishWetCapacityUnit;
import junit.framework.TestCase;

/**
 * @author Michael Swann
 */
public class EnglishWetCapacityUnitValidation extends TestCase {

	// Amount of Error Allowed
	private static final double						DELTA					= 0.01;

	private static final double						FLUIDOUNCES_VALUE		= 128;
	private static final double						PINTS_VALUE				= 8;
	private static final double						QUARTS_VALUE			= 4;
	private static final double						GALLONS_VALUE			= 1;
	private static final double						LITERS_VALUE			= 3.7854117891;

	private static final double						values[]				= { FLUIDOUNCES_VALUE, PINTS_VALUE, QUARTS_VALUE, GALLONS_VALUE, LITERS_VALUE };
	private static final EnglishWetCapacityUnit[]	englishWetCapacityUnits	= EnglishWetCapacityUnit.values();

	public EnglishWetCapacityUnitValidation() {
	}

	@Override
	protected void setUp() throws Exception {
		super.setUp();
	}

	/**
	 * Test method for
	 * {@link mach2convert.englishunit.EnglishWetCapacityUnit#convert(double, mach2convert.englishunit.EnglishWetCapacityUnit)}
	 * .
	 */
	public final void testConvert() {
		for (int i = 0; i < englishWetCapacityUnits.length; i++) {
			for (int j = 0; j < englishWetCapacityUnits.length; j++) {
				double result = englishWetCapacityUnits[i].convert(values[j], englishWetCapacityUnits[j]);
				System.out.println("ASSERT: " + values[i] + " = " + result + " " + englishWetCapacityUnits[i] + ".convert(" + values[j] + ", " + englishWetCapacityUnits[j] + "))");
				assertEquals(values[i], result, DELTA);
			}
		}
	}

	/**
	 * Test method for
	 * {@link mach2convert.englishunit.EnglishWetCapacityUnit#toOunces(double)}.
	 */
	public final void testToOunces() {
		for (int i = 0; i < englishWetCapacityUnits.length; i++) {
			double result = englishWetCapacityUnits[i].toFluidOunces(values[i]);
			System.out.println("ASSERT: " + FLUIDOUNCES_VALUE + " = " + result + " " + englishWetCapacityUnits[i] + ".toFluidOunces(" + values[i] + ") ");
			assertEquals(FLUIDOUNCES_VALUE, result, DELTA);
		}
	}

	/**
	 * Test method for
	 * {@link mach2convert.englishunit.EnglishWetCapacityUnit#toPints(double)}.
	 */
	public final void testToPints() {
		for (int i = 0; i < englishWetCapacityUnits.length; i++) {
			double result = englishWetCapacityUnits[i].toPints(values[i]);
			System.out.println("ASSERT: " + PINTS_VALUE + " = " + result + " " + englishWetCapacityUnits[i] + ".toPints(" + values[i] + ") ");
			assertEquals(PINTS_VALUE, result, DELTA);
		}
	}

	/**
	 * Test method for
	 * {@link mach2convert.englishunit.EnglishWetCapacityUnit#toQuarts(double)}.
	 */
	public final void testToQuarts() {
		for (int i = 0; i < englishWetCapacityUnits.length; i++) {
			double result = englishWetCapacityUnits[i].toQuarts(values[i]);
			System.out.println("ASSERT: " + QUARTS_VALUE + " = " + result + " " + englishWetCapacityUnits[i] + ".toQuarts(" + values[i] + ") ");
			assertEquals(QUARTS_VALUE, result, DELTA);
		}
	}

	/**
	 * Test method for
	 * {@link mach2convert.englishunit.EnglishWetCapacityUnit#toGallons(double)}
	 * .
	 */
	public final void testToGallons() {
		for (int i = 0; i < englishWetCapacityUnits.length; i++) {
			double result = englishWetCapacityUnits[i].toGallons(values[i]);
			System.out.println("ASSERT: " + GALLONS_VALUE + " = " + result + " " + englishWetCapacityUnits[i] + ".toGallons(" + values[i] + ") ");
			assertEquals(GALLONS_VALUE, result, DELTA);
		}
	}

	/**
	 * Test method for
	 * {@link mach2convert.englishunit.EnglishWetCapacityUnit#toLiters(double)}.
	 */
	public final void testToLiters() {
		for (int i = 0; i < englishWetCapacityUnits.length; i++) {
			double result = englishWetCapacityUnits[i].toLiters(values[i]);
			System.out.println("ASSERT: " + LITERS_VALUE + " = " + result + " " + englishWetCapacityUnits[i] + ".toLiters(" + values[i] + ") ");
			assertEquals(LITERS_VALUE, result, DELTA);
		}
	}

}